<!--- Title Field --->
<div class="form-group">
    {!! Form::label('title', '标题:') !!}
    {!! Form::text('title', null, ['class' => 'form-control']) !!}
</div>

@inject('tag','App\Models\Tag')
@inject('category','App\Models\Category')
@inject('roles','App\Models\Role')

<div class="form-group">
    <div class="col-sm-9">
    <label class="col-sm-3">分类</label>
        <select class=" select2" multiple="multiple" name="category_id[]" >
            @foreach($category::all() as $categoryData)
                <option value="{{$categoryData->id}}">{{$categoryData->name}}</option>
            @endforeach
        </select>
    </div>
</div>
<div class="form-group">
    <label class="col-sm-3">标签</label>
        <select class=" select2" id='tag_id' multiple="multiple" name="tag_id[]" >
            @foreach($tag::all() as $tagData)
                <option value="{{$tagData->id}}">{{$tagData->name}}</option>
            @endforeach
        </select>
</div>
<div class="form-group">
    <label class="col-sm-3 control-label">用户角色</label>
    <div class="col-sm-9">
        <select class="form-control select2" multiple="multiple" name="role_id[]" style="width: 100%">
            @foreach($roles->all() as $role)
                <option value="{{$role->id}}")>{{$role->display_name}}</option>
            @endforeach
        </select>
        @include('admin.layout.message.tips',['field'=>'role_id'])
    </div>
</div>
<!--- Body Field --->
<div class="form-group">
    <div class="editor">
    {!! Form::label('body', '文章:') !!}
    {{--{!! Form::textarea('body', null, ['class' => 'form-control']) !!}--}}
    {!! Form::textarea('body', '', ['class' => 'form-control','id'=>'myEditor']) !!}
    </div>
</div>
@section('script')
    <script type="text/javascript">
        $(function () {
            $(".select2").select2();
        });
    </script>
@stop